Imports System.Text

Public Class CreateXmlFile
    Public Sub CreateXMLFile()

        Try

            If My.Computer.FileSystem.DirectoryExists(My.Computer.FileSystem.CurrentDirectory & "\Plugins\") = False Then
                My.Computer.FileSystem.CreateDirectory(My.Computer.FileSystem.CurrentDirectory & "\Plugins\")
            End If

            Dim myXml As StringBuilder = New StringBuilder
            myXml.Append("<?xml version=""1.0"" encoding=""utf-8""?>")
            myXml.Append(vbCrLf)
            myXml.Append("<Sites>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""Technorati"">")
            myXml.Append(vbCrLf)
            myXml.Append("<tagFormat><![CDATA[<a href=""http://technorati.com/tag/{tag}"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append("<inUse>true</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""del.icio.us"">")
            myXml.Append(vbCrLf)
            myXml.Append("<tagFormat><![CDATA[<a href=""http://del.icio.us/popular/{tag}"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append(" <inUse>false</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""Flickr"">")
            myXml.Append(vbCrLf)
            myXml.Append("<tagFormat><![CDATA[<a href=""http://www.flickr.com/photos/tags/{tag}/"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append("<inUse>false</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""IceRocket"">")
            myXml.Append(vbCrLf)
            myXml.Append(" <tagFormat><![CDATA[<a href=""http://blogs.icerocket.com/search?q={tag}"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append("<inUse>false</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""Buzznet"">")
            myXml.Append(vbCrLf)
            myXml.Append("<tagFormat><![CDATA[<a href=""http://www.buzznet.com/tags/{tag}/"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append("<inUse>false</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""43 Things"">")
            myXml.Append(vbCrLf)
            myXml.Append("<tagFormat><![CDATA[<a href=""http://www.43things.com/tag/{tag}"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append("<inUse>false</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("<site name=""LiveJournal"">")
            myXml.Append(vbCrLf)
            myXml.Append("<tagFormat><![CDATA[<a href=""http://www.livejournal.com/interests.bml?int={tag}"" rel=""tag"" class=""tag"">{displaytag}</a>]]></tagFormat>")
            myXml.Append(vbCrLf)
            myXml.Append("<inUse>false</inUse>")
            myXml.Append(vbCrLf)
            myXml.Append("</site>")
            myXml.Append(vbCrLf)
            myXml.Append("</Sites>")
            myXml.Append(vbCrLf)

            My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.CurrentDirectory & "\Plugins\TagTemplates.xml", myXml.ToString.Trim, False)

        Catch ex As Exception

            Dim mylog As New LogFile
            mylog.WriteToLog(ex.Message.ToString & " " & ex.InnerException.ToString)

        End Try

    End Sub
End Class


